package com.example.test;

import android.graphics.drawable.AnimationDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {

    private ImageView img;
    private AnimationDrawable animationDrawable;
    AnimationDrawable anim;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        img = (ImageView) findViewById(R.id.img);
        animationDrawable = (AnimationDrawable) img.getDrawable();
    }

    @Override
    protected void onResume() {
        super.onResume();
        animationDrawable.start();
    }
}
